import React, { Component } from "react";
import WithTimer from "../components/withTimer";

class demo01 extends Component {
  constructor(props) {
    super(props);
    //console.log("constructor");
    this.state = { data: new Date() };
  }
  // tick = () => {
  //   this.setState({ date: new Date() });
  // };
  componentDidMount() {
    //console.log("componentDidMount");
    // this.timerID = setInterval(() => {
    //   this.tick();
    // }, 1000);
  }
  componentWillUnmount() {
    // console.log("componentWillUnmount");
    // clearInterval(this.timerID);
  }
  componentDidUpdate() {
   // console.log("componentDidUpdate");
  }
  render() {
    //const { date } = this.state;
    const { time } = this.props;
    return <div>{time && time.toString()}</div>;
  }
}

export default WithTimer(demo01);
